﻿@using CMSMVC4.MultiResource
@model List<CMSMVC4.CateLang>


@{
    ViewBag.Title = @Admin.Equipments;
    Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";
}
<script language="javascript" type="text/javascript">
    function dellall() {
        var chek = $('#checkall').is(':checked');
        if (chek == true) {
            $(".checker span").attr('class', "checked");
            $(".dell").attr('checked', true);
        } else {
            $(".checker span").attr('class', "");
            $(".dell").attr('checked', false);

        }
    }
    function senddell() {
        var id = [];
        $(".dell:checked").each(function () {
            var v = $(this).attr("index");
            id.push(v);
        });
        if (id.length > 0) {
            var cf = confirm("Bạn có chắc chắn muốn xóa không?");
            if (cf == true) {
                $.ajax({
                    type: "Post",
                    dataType: "json",
                    contentType: 'application/json; charset=utf-8',
                    url: "/Admin/ThietBi/XoaDanhMuc",
                    data: JSON.stringify(id),
                    success: function () {
                        window.location = "/Admin/ThietBi/DanhMuc";
                    }
                });
            }
        } else {
            alert("Hãy chọn bưu gửi muốn xóa!");
        }
    }
</script>
<div class="row-fluid">
    <div class="box color_4">
        <div class="title">
            <h4><span>Danh Sách Danh Mục <small></small></span></h4>
        </div>
        <div class="content top">
            <table id="datatable_example" class="responsive table table-striped table-bordered" style="width: 100%">
                <thead>
                    <tr>
                        <th class="jv no_sort">
                                <label class="checkbox ">
                                    <input type="checkbox" id="checkall" onchange="dellall()"/>
                                </label>
                            </th>
                        <th style="display: none">ID</th>
                        <th class="">@Admin.Equipments </th>
                        <th class="to_hide_phone">@Admin.Actions</th>
                    </tr>
                </thead>
                <tbody>
                    @if (Model != null)
                    {
                        foreach (var item in Model)
                        {
                            <tr>
                                <td>
                                    @Html.CheckBox("status",new{@class="dell",index =item.CategoriesId})
                                </td>
                                <td style="display: none">@item.Id</td>
                                <td class="">@item.Name</td>
                                <td class="ms">
                                    <a class="btn btn-small" rel="tooltip" data-original-title="@Admin.DetailOrEdit" data-ajax="false" 
                                       data-ajax-method="Get" 
                                       href="@Url.Action("SuaDanhMuc", new { id = item.CategoriesId })">
                                        <i class="gicon-edit"></i>
                                    </a>
                                    <a class="btn btn-small" onclick="senddell()">
                                        <i class="gicon-remove"></i>
                                    </a>
                                </td>
                            </tr> 
                        }
                    }
                </tbody>
            </table>
        </div>
    </div>
</div>

<a class="btn btn-large btn-success" href="@Url.Action("ThemDanhMuc","ThietBi")">Thêm Danh Mục</a>
<div id="boxes">
    <div id="dialog" style="overflow: auto"></div>
    <div id="dialog_nen"></div>
</div>
